package com.hzjh.base.frame.fragment

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.CallSuper
import androidx.viewbinding.ViewBinding
import com.hzjh.base.frame.BaseViewModel

abstract class BaseTVMFragment<T : ViewBinding, VM : BaseViewModel> : AbsVMFragment<VM>() {

    protected lateinit var viewBinding: T


    abstract fun getViewBinding(
        inflater: LayoutInflater,
        container: ViewGroup?
    ): T


    override fun setContentView(inflater: LayoutInflater, container: ViewGroup?): View {
        viewBinding = getViewBinding(inflater, container)
        return viewBinding.root
    }


    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        initData()
        initView(view)
        startObserve()
    }


    abstract fun startObserve()
    abstract fun initData()
    abstract  fun initView(view: View)


}